package ab.mes.service.impl;

import ab.mes.entity.FinishedProductBin;
import ab.mes.entity.FinishedProductBinStock;
import ab.mes.mapper.FinishedProductBinMapper;
import ab.mes.mapper.FinishedProductBinStockMapper;
import ab.mes.service.FinishedProductBinStockService;
import ab.mes.tools.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class FinishedProductBinStockServiceImpl implements FinishedProductBinStockService {
    @Autowired
    private FinishedProductBinStockMapper finishedProductBinStockMapper;

    //获取库位信息
    public Result getFinishedProductBinStock(){
        Result result = new Result();
        result.getMap().put("finished_product_bin_stock",finishedProductBinStockMapper.getFinishedProductBinStock());
        return result;
    }

    //根据库位编号查询物料库位信息
    public Result getFinishedProductBinStockById(String Id){
        Result result = new Result();
        result.getMap().put("finished_product_bin_stock",finishedProductBinStockMapper.getFinishedProductBinStockById(Id));
        return result;
    }


    //新增库位
    public Result insertFinishedProductBinStock(FinishedProductBinStock finishedProductBinStock){
        Result result = new Result();
        result.getMap().put("finished_product_bin_stock",finishedProductBinStockMapper.editFinishedProductBinStock(finishedProductBinStock));
        return result;
    }

    //编辑库位
    public Result editFinishedProductBinStock(FinishedProductBinStock finishedProductBinStock){
        Result result = new Result();
        result.getMap().put("finished_product_bin_stock",finishedProductBinStockMapper.insertFinishedProductBinStock(finishedProductBinStock));
        return result;
    }
}
